package week2.day11;

/**
 * @Author fengzihao
 * @Date 2024-04-25 19:56
 */
public class TeacherAndStudentTest {
    public static void main(String[] args) {
        // 抽象类不能new对象
        // Person person1 = new Person();
        Person person1 = new Teacher();
        System.out.println("person1.name = " + person1.name);
        System.out.println("person1.gender = " + person1.gender);
        System.out.println("person1.age = " + person1.age);
        person1.eat();
        person1.sleep();
        System.out.println("========================================");
        Person person2 = new Student();
        System.out.println("person2.name = " + person2.name);
        System.out.println("person2.gender = " + person2.gender);
        System.out.println("person2.age = " + person2.age);
        person2.eat();
        person2.sleep();
    }
}
abstract class Person{
    String name;
    String gender;
    int age;
    public abstract void eat();
    public abstract void sleep();
}

interface SkillLearn{
    void learn();
}

class Teacher extends Person implements SkillLearn{

    @Override
    public void eat() {
        System.out.println("老师吃饭");
    }

    @Override
    public void sleep() {
        System.out.println("老师睡觉");
    }

    @Override
    public void learn() {
        System.out.println("老师增强语言能力");
    }
}
class Student extends Person implements SkillLearn{

    @Override
    public void eat() {
        System.out.println("学生吃饭");
    }

    @Override
    public void sleep() {
        System.out.println("学生睡觉");
    }

    @Override
    public void learn() {
        System.out.println("学生增强实践动手能力");
    }
}
